﻿#pragma once

#include <wx/wx.h>
#include <wx/panel.h>
#include <vector>
#include <math.h>
#include "..\json\json.h"
#include <wx/dcbuffer.h>

class Board : public wxPanel
{
public:
    Board(wxPanel* parent);
    void OnMouse(wxMouseEvent& event);
    void JsonAdd(wxPoint startP, wxPoint endP);
    void Move(wxPoint pos);

    void Clear();
    void Back();
    void OnTimer(wxTimerEvent& event);
    void Search(wxMouseEvent& event);
    void Delete();
    void Copy();

    void OnPaint(wxPaintEvent& event);
    void _paintrect(wxPoint startP, wxPoint endP, wxMemoryDC& dc);
    void _paintroud(wxPoint startP, wxPoint endP, wxMemoryDC& dc);
    void _paintarc(wxPoint startP, wxPoint endP, wxMemoryDC& dc);
    void OnMouseWheel(wxMouseEvent& event);

    bool  nowable;     //是否可以绘制
    bool  isdraw;
    bool  hasline;
    std::vector<Json::Value> draws;
    Json::Value* now;//选中的图形的地址

    wxTimer* timer; // 定时器
    wxPoint Pos;
    wxStaticText* st1;
    wxStaticText* st2;

    wxPoint startP, endP, centerP;
    wxPanel* m_parent;

    double zoomFactor = 1;
    int pointnum = 0;
};